{extend name="../../admin/view/main"}

{block name="button"}
<!--{if auth("clean")}-->
<button class='layui-btn layui-btn-sm layui-btn-primary' data-queue='{:url("clean")}'>定时清理订单</button>
<!--{/if}-->
{/block}

{block name="content"}
<div class="layui-tab layui-tab-card">
    <ul class="layui-tab-title notselect">
        {php}$types = ['ta' => '全部订单', 't2' => '等待支付', 't3' => '等待审核', 't4' => '等待发货', 't5' => '等待收货', 't6' => '已经完成', 't0' => '已经取消'];{/php}
        {foreach $types as $k=>$v}{if isset($type) and 't'.$type eq $k}
        <li class="layui-this" data-open="{:url('index')}?type={$k}">{$v}<sup class="layui-badge border-radius">{$total[$k]??0}</sup></li>
        {else}
        <li data-open="{:url('index')}?type={$k}">{$v}<sup class="layui-badge border-radius">{$total[$k]??0}</sup></li>
        {/if}{/foreach}
    </ul>
    <div class="layui-tab-content">
        {include file='shop/order/index_search'}
        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th class='list-table-check-td think-checkbox'>
                    <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
                </th>
                <th>用户信息</th>
                <th>订单信息</th>
                <th>发货信息</th>
                <th>商品信息</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='list-table-check-td think-checkbox'>
                    <label><input class="list-check-box" type='checkbox' value='{$vo.id}'></label>
                </td>
                <td class="nowrap relative">
                    <div>
                        <!--{notempty name='vo.from'}-->
                        <div class="headimg" data-lazy-src="{$vo.from.headimg|default='__ROOT__/static/theme/img/headimg.png'}" data-tips-image></div>
                        <div class="inline-block sub-strong-red">
                            <div>推荐用户：<span class="color-text">{$vo.from.nickname|default='--'}</span><span class="margin-left-5">[ <b>VIP{$vo.from.vip_code}</b> ] <b>{$vo.from.vip_name}</b></span></div>
                            <div>推荐手机：<span class="color-text">{$vo.from.phone|default='--'}</span></div>
                        </div>
                        <!--{else}-->
                        <div class="color-desc padding-10">没有代理</div>
                        <!--{/notempty}-->
                    </div>
                    <div>
                        <div class="headimg" data-lazy-src="{$vo.user.headimg|default='__ROOT__/static/theme/img/headimg.png'}" data-tips-image></div>
                        <div class="inline-block sub-strong-red">
                            用户昵称：<span class="color-text">{$vo.user.nickname|default='--'}</span><span class="margin-left-5">[ <b>VIP{$vo.user.vip_code}</b> ] <b>{$vo.user.vip_name}</b></span><br>
                            用户手机：<span class="color-text">{$vo.user.phone|default='--'}</span><br>
                        </div>
                    </div>
                </td>
                <td class='nowrap'>
                    {eq name='vo.status' value='0'}<span class="layui-badge layui-badge-middle layui-bg-gray layui-border-cyan" data-tips-text="{$vo.cancel_remark}">已经取消</span>{/eq}
                    {eq name='vo.status' value='1'}<span class="layui-badge layui-badge-middle layui-bg-red">预购订单</span>{/eq}
                    {eq name='vo.status' value='2'}<span class="layui-badge layui-badge-middle layui-bg-red">等待待付款</span>{/eq}
                    {eq name='vo.status' value='3'}<span class="layui-badge layui-badge-middle layui-bg-orange">等待审核</span>{/eq}
                    {eq name='vo.status' value='4'}<span class="layui-badge layui-badge-middle layui-bg-black">等待发货</span>{/eq}
                    {eq name='vo.status' value='5'}<span class="layui-badge layui-badge-middle layui-bg-blue">已经发货</span>{/eq}
                    {eq name='vo.status' value='6'}<span class="layui-badge layui-badge-middle layui-bg-green">已经完成</span>{/eq}
                    <div class="inline-block text-middle">
                        <div class="sub-strong-blue">
                            订单单号：<b>{$vo.order_no|default=''}</b>
                            <!--{eq name='vo.status' value='3'}-->
                            <a class="margin-left-5 layui-badge layui-bg-blue" data-modal="{:url('audit')}?order_no={$vo.order_no}">凭证审核</a>
                            <!--{/eq}-->
                        </div>
                        <div class="sub-strong-blue">
                            订单总计：<b>{$vo.amount_total+0}</b> 元
                            <span class="color-green">{if $vo.amount_express>0}(含运费 {$vo.amount_express+0} 元{else}(包邮{/if}, 随减 {$vo.amount_reduct+0} 元)</span>
                            已支付 <b>{$vo.payment_amount+0}</b> 元
                        </div>
                        <div>下单时间：<span class="color-text">{$vo.create_at|format_datetime}</span></div>
                        <!--{notempty name='vo.payment_status'}-->
                        <div>
                            支付时间：<span class="color-text">{$vo.payment_datetime|format_datetime}</span>
                            {notempty name='vo.payment_name'}
                            <!--{notempty name='vo.payment_image'}-->
                            <b class="margin-left-5 color-blue" data-tips-image="{$vo.payment_image}" data-tips-text="{$vo.payment_remark|default=''}">({$vo.payment_name|default='-'})</b>
                            <!--{else}-->
                            <b class="margin-left-5 color-blue">({$vo.payment_name|default='-'})</b>
                            <!--{/notempty}-->
                            {/notempty}
                        </div>
                        <!--{else}-->
                        支付状态：<span class="color-desc">还未支付</span>
                        <!--{/notempty}-->
                    </div>
                </td>
                <td class="nowrap">
                    {empty name='vo.truck_type'}
                    无需发货
                    {else}
                    <div>收货信息：{$vo.truck.address_name|default='--'}<span class="margin-left-5 color-blue">{$vo.truck.address_phone|default=''}</span></div>
                    <div>收货地址：{$vo.truck.address_province|default='--'}{$vo.truck.address_city|default=''}{$vo.truck.address_area|default=''}{$vo.truck.address_content|default=''}</div>
                    <div>发货状态：<!--{if empty($vo.truck.send_number)}--><span class="layui-badge layui-bg-black">未发货</span><!--{else}--><span class="layui-badge layui-bg-blue">{$vo.truck.company_name|default='--'}</span>
                        <a class="layui-badge layui-bg-orange" data-modal="{:url('shop.send/query')}?code={$vo.truck.company_code|default=''}&number={$vo.truck.send_number|default=''}" data-title="快递查询">{$vo.truck.send_number|default='--'}</a>
                        <!--{/if}-->

                        <!--{if auth('shop.send/truck') and $vo.status eq 3}-->
                        <a class="margin-left-5" data-modal="{:url('shop.send/truck')}?order_no={$vo.order_no}" data-title="填写订单信息">填写发货</a>
                        <!--{elseif auth('shop.send/truck') and $vo.status eq 4}-->
                        <a class="margin-left-5" data-modal="{:url('shop.send/truck')}?order_no={$vo.order_no}" data-title="修改发货信息">修改发货</a>
                        <!--{/if}-->

                        <!--{if auth('cancel') and in_array($vo.status, [1,2,3])}-->
                        <a class="margin-left-5" data-confirm="确认要取消订单吗？" data-load="{:url('cancel')}?order_no={$vo.order_no}">取消订单</a>
                        <!--{/if}-->
                    </div>
                    <div>发货时间：{$vo.truck.send_datetime|default='--'}</div>
                    {/empty}
                </td>
                <td class="nowrap">
                    {foreach $vo.items as $g}
                    <div>
                        {if $g.vip_entry > 0 and $g.vip_upgrade > $g.vip_code}
                        [ <b class="color-red">VIP{$g.vip_code}</b> <span class="layui-icon font-s10 color-blue">&#xe602;</span> <b class="color-red">VIP{$g.vip_upgrade}</b> ]
                        {else}
                        [ <b class="color-text">VIP{$g.vip_code}</b> ]
                        {/if}
                        {if $g.discount_rate < 100.00}
                        <b class="color-blue">享{$g.discount_rate+0}%折扣</b><span class="color-red"> x </span>
                        {/if}
                        <b class="color-blue">{$g.stock_sales|default=0}件</b><span class="color-red"> x </span><b class="color-blue">{$g.price_selling+0}元 </b>
                        {$g.goods_name|default=''} <span class="color-green"> ( {$g.goods_spec|show_goods_spec} )</span>
                    </div>
                    {/foreach}
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>
{/block}
